package com.shuai.spi;

import com.shuai.serializer.Serializer;
import java.util.ServiceLoader;

/**
 * @author : 帅宏-coding
 * @version : 1.0
 */
public class SpiLoader_One {
  public static void main(String[] args)
      throws InstantiationException, IllegalAccessException, ClassNotFoundException {
    System.out.println("SpiLoader_One");
    ServiceLoader<Serializer> loader = ServiceLoader.load(Serializer.class);
    for (Serializer serializer : loader) {
      Class<?> clazz = serializer.getClass();
      System.out.println("clazz : " + clazz);
      String className = serializer.getClass().getName();
      Class<?> aClass = Class.forName(className);
      System.out.println("aClass : " + aClass);
      System.out.println("className : " + className);
    }
  }
}
